{
 "cells": [
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": [
    "# Copyright 2025 Apache Software Foundation\n",
    "#\n",
    "# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
    "# you may not use this file except in compliance with the License.\n",
    "# You may obtain a copy of the License at\n",
    "#\n",
    "#     http://www.apache.org/licenses/LICENSE-2.0\n",
    "#\n",
    "# Unless required by applicable law or agreed to in writing, software\n",
    "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
    "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
    "# See the License for the specific language governing permissions and\n",
    "# limitations under the License."
   ],
   "id": "d1d5e86fb8bcd92f"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "!pip install burr[start]",
   "id": "a1e0bae74e5d0d91"
  },
  {
   "cell_type": "markdown",
   "id": "0ebb856d-fdb0-412c-8eaf-27af91a35ce3",
   "metadata": {},
   "source": [
    "# Simple Multi-Modal chatbot\n",
    "\n",
    "This runs through an example of a multi-modal chatbot. Follow in the [application.py] file for specific implementation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "89b22472-8074-4adb-9d19-fcbaf8cd94c2",
   "metadata": {},
   "outputs": [],
   "source": [
    "from application import application as multi_modal_chatbot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "84068205-605f-45c8-9b2e-5a3f787d598a",
   "metadata": {},
   "outputs": [],
   "source": [
    "app = multi_modal_chatbot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0b21d035-ec45-4606-b3d7-e4dfd0266a47",
   "metadata": {},
   "outputs": [],
   "source": [
    "app.visualize(include_conditions=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "923beb31-3abf-4511-9f86-007a46734f21",
   "metadata": {},
   "outputs": [],
   "source": [
    "action, result, state = app.run(halt_after=[\"response\"], inputs={\"prompt\" : \"please draw a turtle\"})\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "de4ca6ad-2eeb-4ba5-8bad-df807546c848",
   "metadata": {},
   "source": [
    "# Viewing in UI\n",
    "\n",
    "The following cell gives you a link to the prior run in the UI. If you have not yet, run `burr` in your terminal to start the local tracking server."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "84e812d2-9a40-4bcb-a031-4e3ab7d4ca1c",
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.display import Markdown\n",
    "url = f\"[Link to UI](http://localhost:7241/project/demo_chatbot/{app.uid})\"\n",
    "Markdown(url)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
